<template>
  <div id="app">
    <ib-header :title="'篱笆聊天'" :you="true"></ib-header>
    <ib-con v-for="item in data" :key="item.id" :name="item.name" :title="item.title" :time="item.time" :con="item.con"></ib-con>
    <footer @click="Submit">
      添加
    </footer>
    <ib-insert v-show="Switch" @Submit="yes"></ib-insert>
  </div>
</template>

<script>
import IbHeader from '@/Ib-header';
import IbCon from '@/Ib-con';
import IbInsert from '@/Ib-insert';
import axios from 'axios';

export default {
  name: 'App',
  components: {
    IbHeader,
    IbCon,
    IbInsert
  },
  data(){
    return {
      data:[],
      Switch:false,
    }
  },
  created(){
    axios.get("/list").then((res) => {
      if(res.data.code == 0){
        this.data = res.data.asg
      }
    })
  },
  methods:{
    Submit(){
      this.Switch = true
    },
    yes(data){
      this.Switch = false
      // console.log(data)
      this.data = data
    }
  }
}
</script>

<style>
*{
  margin: 0;
  padding: 0;
  list-style: none;;
  box-sizing: border-box;
}
body,html{
  width: 100%;
  height:100%;
}
#app {
  width: 100%;
  height:100%;
  padding-top: 50px;
}
footer{
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50px;
  /* border: 2px solid rgb(206, 75, 75); */
  background: rgb(136, 204, 109);
  text-align: center;
  line-height: 50px;;
  font-weight: 600;
  font-size: 20px;
  color: #fff;
}
</style>
